<ion-view cache-view="false" view-title="用户升级">
    <ion-nav-buttons side="left">
        <a class="button button-icon ion-arrow-left-c" ng-click="goBack()"></a>
    </ion-nav-buttons>

    <ion-content class="padding has-tabs-top">
        <form ng-if="!userRoleStatus.roleUpdated" name="detailForm" novalidate="" ng-submit="submitForm(detailForm)">
            <div class="list">

                <label class="item item-input">
                   {{info.updateMsg}}请完善您的农户信息
                </label>
                <label class="item item-input">
                    <span class="input-label">姓名<span style="color:red">*</span>：</span>
                    <input type="text" name="farmer_name" ng-model="accountInfo.farmer_name"
                           required
                           ng-maxlength="20"
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.farmer_name.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-maxlength-20.html"></div>
                </div>

                <label class="item item-radio">
                    <input type="radio" name="gender" value="男" ng-model="accountInfo.gender">
                    <div class="item-content">
                        男
                    </div>
                    <i class="radio-icon ion-checkmark"></i>
                </label>

                <label class="item item-radio">
                    <input type="radio" name="gender" value="女" ng-model="accountInfo.gender">
                    <div class="item-content">
                        女
                    </div>
                    <i class="radio-icon ion-checkmark"></i>
                </label>
                <label class="item item-input">
                    <span class="input-label">手机号<span style="color: red;">*</span>：</span>
                    <input type="text" name="cell"  ng-pattern="/^((13[0-9])|147|(15[0-35-9])|180|182|(18[5-9]))[0-9]{8}$/" ng-model="accountInfo.cell"
                           required
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!--Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':myForm.userCell.$dirty}"
                     ng-messages="form.cell.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-cell-error.html"></div>
                </div>

                <insert-address  form="detailForm"  addressoption="addressOption"></insert-address>
                <label class="item item-input">
                    <span class="input-label">详细地址：</span>
                    <input type="text" name="addr_details" ng-model="accountInfo.addr_details"
                           ng-maxlength="20"
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.addr_details.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-maxlength-20.html"></div>
                </div>

                <label class="item item-input">
                    <span class="input-label">农户类型：</span>
                    <input type="text" name="type" ng-model="accountInfo.type"
                           ng-maxlength="10"
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.type.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-maxlength-10.html"></div>
                </div>
                <label class="item item-input">
                    <span class="input-label">耕地面积：</span>
                    <input type="text" name="farm_area" ng-model="accountInfo.farm_area"
                           ng-pattern='/^\d{1,8}([\.]\d{0,2})?$/'
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!-- Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.farm_area.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-errors.html"></div>
                </div>
                <label class="item item-input">
                    <span class="input-label">土壤种类：</span>
                    <input type="text" name="soil_type" ng-model="accountInfo.soil_type"
                           ng-maxlength="10"
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.soil_type.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-maxlength-10.html"></div>
                </div>

                <label class="item item-input">
                    <span class="input-label">肥沃程度：</span>
                    <input type="text" name="soil_fertility" ng-model="accountInfo.soil_fertility"
                           ng-maxlength="10"
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.soil_fertility.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-maxlength-10.html"></div>
                </div>


                <button class="button button-full button-positive" ng-disabled="detailForm.$invalid" type="submit">
                提交
            </button>
            </div>
        </form>
        <div ng-if="userRoleStatus.roleUpdated" class="list">
            <label class="item ">

                <div class="item-content">
                    {{info.updateMsg}}
                </div>

            </label>
        </div>
    </ion-content>

    <!--头部和内容结束-->
</ion-view>